<?php

namespace Ihanpy\Core;

use Ihanpy\Core\Route;

class Application
{
    public static function run()
    {
        $route = new Route();
        $controller = $route->controller;
        $action = $route->action;

        if (!empty($controller)) {
            $controller = '\\Ihanpy\App\Controller\\' . $controller . 'Controller';
        }
        $controllerObject = new $controller();
        if (!method_exists($controllerObject, $action)) {
            // 抛异常吧
        }

        return $controllerObject->$action();
    }
}